1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module glib.TestSuite;
26 
27 private import glib.TestCase;
28 private import glib.c.functions;
29 public  import glib.c.types;
30 private import linker.Loader;
31 
32 
33 /**
34  * An opaque structure representing a test suite.
35  */
36 public class TestSuite
37 {
38 	/** the main Gtk struct */
39 	protected GTestSuite* gTestSuite;
40 	protected bool ownedRef;
41 
42 	/** Get the main Gtk struct */
43 	public GTestSuite* getTestSuiteStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return gTestSuite;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected void* getStruct()
52 	{
53 		return cast(void*)gTestSuite;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (GTestSuite* gTestSuite, bool ownedRef = false)
60 	{
61 		this.gTestSuite = gTestSuite;
62 		this.ownedRef = ownedRef;
63 	}
64 
65 	~this ()
66 	{
67 		if ( Linker.isLoaded(LIBRARY_GLIB[0]) && ownedRef )
68 			g_test_suite_free(gTestSuite);
69 	}
70 
71 
72 	/**
73 	 * Adds @test_case to @suite.
74 	 *
75 	 * Params:
76 	 *     testCase = a #GTestCase
77 	 *
78 	 * Since: 2.16
79 	 */
80 	public void add(TestCase testCase)
81 	{
82 		g_test_suite_add(gTestSuite, (testCase is null) ? null : testCase.getTestCaseStruct());
83 	}
84 
85 	/**
86 	 * Adds @nestedsuite to @suite.
87 	 *
88 	 * Params:
89 	 *     nestedsuite = another #GTestSuite
90 	 *
91 	 * Since: 2.16
92 	 */
93 	public void addSuite(TestSuite nestedsuite)
94 	{
95 		g_test_suite_add_suite(gTestSuite, (nestedsuite is null) ? null : nestedsuite.getTestSuiteStruct());
96 	}
97 
98 	/**
99 	 * Free the @suite and all nested #GTestSuites.
100 	 *
101 	 * Since: 2.70
102 	 */
103 	public void free()
104 	{
105 		g_test_suite_free(gTestSuite);
106 		ownedRef = false;
107 	}
108 }